#ifndef MARKET_H_
#define MARKET_H_
#include <vector>
#include "BuyEvent.h"
#include "SellEvent.h"
#include "CreateEvent.h"
#include "ConsumeEvent.h"
#include "AccountReport.h"
#include "ActivityReport.h"
#include "EnergyReport.h"
#include "ProfitReport.h"
#include "UserReport.h"
#include "Agent.h"
#include "MarketReport.h"

class Market {
private:
	std::vector<User*> users; //created in bob-the-builder
	std::vector<Events*> events; //read from file
	std::vector<BuyEvent*> buys; //created empty in bob-the-builder
	std::vector<SellEvent*> sells; //created empty in bob-the-builder
	vector<double> energyValue; //read from file
	vector<int> energyAmount; //total amount of each energy
	Poco::DateTime * lastDealDate;
	CMarketReport CMR; //
	bool AgentOn; //read from file
	std::vector<Events*> sayaEvents;



	//methode already created
	void executeCreateConsume();
	User* getUser (int id);
	void readBuysSells();
	void executeDeals();
	void recalculate_the_state_of_the_system();
	void generate_Saya_events();
	void execute_the_report_events();
	void endOfDay();

	void execute (UserReport *report);
	void execute (AccountReport *report);
	void execute (EnergyReport *report);
	void execute (ActivityReport *report);
	void execute (ProfitReport *report);


public:
	Market();
	Market(std::vector<User*> tUsers, std::vector<BuyEvent*> tBuyEvents, std::vector<SellEvent*> tSellEvents); //used for testing
	Market(Bank& newBank, std::vector<Events*>* eevents, bool AgentOn, std::string confFile, std::string eventFile, int id1, int id2, vector<double> energyValue, double firstYitra, double sayaBuy);
	void startSim();
	virtual ~Market();
	bool deal(User* buyer, User* seller);
};

#endif /*MARKET_H_*/
